<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body onload="">
        <?php
            $idToEdit = $_POST['wdToDeleteId'];
            $rowToDelete = $_POST['wdToDeleteRowId'];
            print("<script type='text/javascript'>
                    rowToRemove = $rowToDelete;
                    </script>");
            include "Datasource.php";
            include "WorkDone.php";
            include "WorkDoneDao.php";
            include "EmployeeDAO.php";
            include "Employee.php";
            $conn = new Datasource("localhost", "theanykey", "root", "");
            $objWdDAO = new WorkDoneDao();
            $objWdToEdit = new WorkDone();
            $objWdToEdit = $objWdDAO->getObject($conn, $idToEdit);
            if($objWdToEdit)
            {
                if($objWdDAO->delete($conn, $objWdToEdit))
                {
        ?>
    <script type="text/javascript">
        otherWindow = window.opener;
        table = otherWindow.document.getElementById("tblWorkDoneOld");
        deleteRow = otherWindow.document.getElementById("rowWorkDoneOld" + (rowToRemove));
        table.deleteRow(deleteRow.rowIndex);
        for(i=0; i<table.rows.length; i++)
        {
            table.rows[i].style.backgroundColor = ((i % 2) == 0) ? "#D8D8D8" : "";
        }
        window.close();
    </script>

    <?php
    }//end results if
}//end if
    ?>
</body>
</html>
